<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1"
	action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.servicemanagement.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.Update") %></div>
		<div class="pageBody">
		
			<h4 class="list-tit">修改前</h4>
			
			<div class="form-group">
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.storecode") %></label>
						<span><input type="text" id="storecode" name="storecode" value="${storeChargeManage.number}" disabled="disabled"/></span>
					</li>
					<li>
						<i></i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.storename") %></label>
						<span><input type="text" id="stroename" name="stroename" value="${storeChargeManage.name}" disabled="disabled"/></span>
					</li>
				</ul>
			
				<ul>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.services.servicesList.servicenum") %></label>
						<span><input type="text" id="servicenum" name="servicenum" value="${storeChargeManage.servicenum}" disabled="disabled"/></span>
					</li>
					<li>
						<i></i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.services.servicesList.servicename") %></label>
						<span><input type="text" id="servicename" name="servicename" value="${storeChargeManage.servicename}" disabled="disabled"/></span>
					</li>
				</ul>
				
				<ul>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.proposed") %></label>
						<span>
							<c:if test="${storeChargeManage.isproposed == yes}">
							<input type="checkbox" id="isproposedchecks" checked="checked" name="isproposedchecks" class="check-box" disabled="disabled"/>
							</c:if>
							<c:if test="${storeChargeManage.isproposed != yes}">
							<input type="checkbox" id="isproposedchecks" name="isproposedchecks" class="check-box" disabled="disabled"/>
							</c:if>
						</span>
					</li>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.proposedprice") %></label>
						<span>
							<c:if test="${storeChargeManage.proposedprice==0.00}">
								<input type="text" id="proposedprices" name="proposedprices" value="" class="iss_amount" disabled="disabled"/>
							</c:if>
							<c:if test="${storeChargeManage.proposedprice!=0.00}">
								<input type="text" id="proposedprices" name="proposedprices" value="${storeChargeManage.proposedprice}" class="iss_amount" disabled="disabled"/>
							</c:if>
						</span>
					</li>
				</ul>
				
				<ul>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.month") %></label>
						<span>
							<c:if test="${storeChargeManage.ismonth == yes}">
								<input type="checkbox" id="ismonthchecks" checked="checked" name="ismonthchecks" class="check-box" disabled="disabled"/>
							</c:if>
							<c:if test="${storeChargeManage.ismonth != yes}">
								<input type="checkbox" id="ismonthchecks" name="ismonthchecks" class="check-box" disabled="disabled"/>
							</c:if>
						</span>
					</li>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.monthprice") %></label>
						<span>
							<c:if test="${storeChargeManage.monthprice ==0.00}">
							<input type="text" id="monthprices" name="monthprices" value="" class="iss_amount" disabled="disabled"/>
							</c:if>
							<c:if test="${storeChargeManage.monthprice !=0.00}">
							<input type="text" id="monthprices" name="monthprices" value="${storeChargeManage.monthprice}" class="iss_amount" disabled="disabled"/>
							</c:if>
						</span>
					</li>
				</ul>
			</div>
			
			
			<h4 class="list-tit">修改后</h4>
			
			<div class="form-group">	
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.storecode") %></label>
						<span><input type="text" id="number" name="number" value="${storeChargeManageTemp.number}" disabled="disabled"/></span>
					</li>
					<li>
						<i></i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.storename") %></label>
						<span><input type="text" id="name" name="name" value="${storeChargeManageTemp.name}" disabled="disabled"/></span>
					</li>
				</ul>
			
				<ul>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.services.servicesList.servicenum") %></label>
						<span><input type="text" id="servicenum" name="servicenum" value="${storeChargeManageTemp.servicenum}" disabled="disabled"/></span>
					</li>
					<li>
						<i></i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.services.servicesList.servicename") %></label>
						<span><input type="text" id="servicename" name="servicename" value="${storeChargeManageTemp.servicename}" disabled="disabled"/></span>
					</li>
				</ul>
				
				<ul>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.proposed") %></label>
						<span>
							<c:if test="${storeChargeManageTemp.isproposed == yes}">
							<input type="checkbox" id="isproposedcheck" checked="checked" name="isproposedcheck" class="check-box" />
							<input type="hidden" id="isproposed" name="isproposed" value="1" />
							</c:if>
							<c:if test="${storeChargeManageTemp.isproposed != yes}">
							<input type="checkbox" id="isproposedcheck" name="isproposedcheck" class="check-box" />
							<input type="hidden" id="isproposed" name="isproposed" value="" />
							</c:if>
						</span>
					</li>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.proposedprice") %></label>
						<span>
							<c:if test="${storeChargeManageTemp.proposedprice==0.00}">
								<input type="text" id="proposedprice" name="proposedprice" value=""  class="iss_amount"/>
							</c:if>
							<c:if test="${storeChargeManageTemp.proposedprice!=0.00}">
								<input type="text" id="proposedprice" name="proposedprice" value="${storeChargeManageTemp.proposedprice}"  class="iss_amount"/>
							</c:if>
						</span>
					</li>
				</ul>
				
				<ul>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.month") %></label>
						<span>
							<c:if test="${storeChargeManageTemp.ismonth == yes}">
								<input type="checkbox" id="ismonthcheck" checked="checked" name="ismonthcheck" class="check-box"/>
								<input type="hidden" id="ismonth" name="ismonth" value="1" />
							</c:if>
							<c:if test="${storeChargeManageTemp.ismonth != yes}">
								<input type="checkbox" id="ismonthcheck" name="ismonthcheck" class="check-box"/>
								<input type="hidden" id="ismonth" name="ismonth" value="" />
							</c:if>
						</span>
					</li>
					<li>
						<i>*</i> 
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.chargemanage.monthprice") %></label>
						<span>
							<c:if test="${storeChargeManageTemp.monthprice ==0.00}">
							<input type="text" id="monthprice" name="monthprice" value=""  class="iss_amount"/>
							</c:if>
							<c:if test="${storeChargeManageTemp.monthprice !=0.00}">
							<input type="text" id="monthprice" name="monthprice" value="${storeChargeManageTemp.monthprice}"  class="iss_amount"/>
							</c:if>
						</span>
					</li>
				</ul>
			</div>
			<div class="button-group">
				<input type="hidden" id="datastatus" name="datastatus" value="${storeChargeManage.datastatus}" />
				<input type="hidden" id="id" name="id" value="${storeChargeManageTemp.id}" />
				<input type="button" class="btn btn-default" id="butSave" name="butSave" value="<%=MessageResourcesUtils.getMessage(request, "common.button.save") %>" />
				<input type="button" class="btn btn-default" id="butReturn" name="butReturn" value='<%=MessageResourcesUtils.getMessage(request, "common.button.back") %>' />
			</div>
		</div>
	</div>
</form>
<script type="text/javascript">
	$(document).ready(function(){
		$("#butReturn").click(function(){
			parent.document.location.reload();
			$.fn.closeIssWindow();
		});
		
		var proposedprice_amount = '';
		var monthprice_amount = '';
		$('#proposedprice').blur(function(){
			proposedprice_amount = $('#proposedprice').val()
		})
		$('#monthprice').blur(function(){
			monthprice_amount = $('#monthprice').val();
		})
		
		
		$('#isproposedcheck').change(function(){
			//如果选中，也填写，则赋值
			if($("#isproposedcheck").prop("checked")){
				$('#isproposed').val('1');
			}else{
				$('#isproposed').val('');
				$('#proposedprice').val('');
				proposedprice_amount = '';
			}
		})
		
		$('#ismonthcheck').change(function(){
			//如果选中，也填写，则赋值
			if($("#ismonthcheck").prop("checked")){
				$('#ismonth').val('1');
			}else{
				$('#ismonth').val('');
				$('#monthprice').val('')
				monthprice_amount = '';
			}
		})
		
		$('#butSave').click(function() {
				//如果 两个单选框都不选择的话，就提示
				if(!($("#isproposedcheck").prop("checked")) && !($("#ismonthcheck").prop("checked"))){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert")%>');
					return;
				}
				
				var proposedprice = proposedprice_amount;
				var monthprice = monthprice_amount;
				//var ismonth = $('#ismonth').val();
				//如果只选中单选框，但不填写价格，就提示
				if($("#isproposedcheck").prop("checked") && proposedprice ==''){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert1")%>');
					return;
				}else if(!$("#isproposedcheck").prop("checked") && proposedprice !=''){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert3")%>');
					return;
				}else if($("#ismonthcheck").prop("checked") && monthprice == ''){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert2")%>');
					return;
				}else if(!$("#ismonthcheck").prop("checked") && monthprice != ''){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert4")%>');
					return;
				}
				if(proposedprice == '0'){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert5")%>');
					return;
				}
				if(monthprice == '0'){
					alert('<%=MessageResourcesUtils.getMessage(request,"alertinfo.chargemanage.Add.alert6")%>');
					return;
				}
				
				if(confirm('<%=MessageResourcesUtils.getMessage(request,"alertinfo.common.jsp.alert1")%>') ){
					showSending();
					form1.action="${systemctx}/dailyoperation/storechargemanage/updateStoreChargeManage.web?proposedprice="+proposedprice+"&monthprice="+monthprice;
					form1.submit();
				}
		});
	});
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>